package com.cz.cloud.client.fallback;

import com.cz.cloud.client.OrderClient;
import com.cz.cloud.client.dto.OrderDTO;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class OrderFallbackFactory implements FallbackFactory<OrderClient> {


    @Override
    public OrderClient create(Throwable cause) {
        return new OrderClient() {

            @Override
            public List<OrderDTO> getOrdersByUserId(Long userId) {
                System.out.println("fallback: getOrdersByUserId 发生异常!");
                return null;
            }
        };
    }
}
